<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="__ROOT__/js/jquery.js"></script>
<script type="text/javascript">
$(function() {
	$('#txtproductID3').bind('input propertychange', function() {SearchResult(this.value)}); 

}) 
function SearchResult(obj){
	if($.trim(obj) == ""){
		return false;
	}
	var rid = $("input[name='radSortName']:checked").val(); 
	$.ajax({  
		type: "post",  
		url: "__URL__/searchkey",
		dataType: 'json',
		data: {keyvalue:obj}, 
		beforeSend: function(XMLHttpRequest){
		},  
		success: function(json){
			var tbody = "";
			if(json != null)
			{
				var trs = ""; 
				tbody = "";
				trs += "<table>";
				$.each(json, function (n, value) {  
	                 trs = "<tr><td>" + value.productid + "</td><td>" + value.tradecode + "</td> <td>" + value.cnname + "</td></tr>";  
	                 tbody += trs;  
                 });
				trs += "</table>"; 
	            $("#divcontent").html(tbody);
			}
            else
            {
                tbody = "没有找到";
                $("#divcontent").html(tbody);
            }
		} 
	})
}

function getvalue(obj){
	var d = $("div.divinfo"); 
	var str = "";
	var flag = false;
     $(d).each(function(){   
          var dId = $(this).attr("id");
          if(dId != "div_"+ obj){   
        	  $('#'+dId).hide();
          }else{
        	  $('#'+dId).show();
        	  if($("#divcontent").length && $("#divcontent").length>0){
        		  $("#divcontent").remove();
        	  }
        	  str = "<div id='divcontent'></div>"
       		  $('#'+dId).append(str);
          }   
       })
}

//基金
function jijingOP(){
	var p = $.trim($("#txtproductID3").val());
	var d = $.trim($("#txtbuyDate3").val());
	var m = $.trim($("#txtprice3").val());
	$.ajax({  
		type: "post",  
		url: "__URL__/jijingOP",
		dataType: 'json',
		data: {p:p,d:d,m:m}, 
		beforeSend: function(XMLHttpRequest){
		},  
		success: function(json){
			alert(json.info);
		} 
	})
	
}

function aa(){
	var p = $.trim($("#txtproductID3").val());
	var d = $.trim($("#txtbuyDate3").val());
	$.ajax({  
		type: "post",  
		url: "__URL__/getFundValue",
		dataType: 'json',
		data: {p:p,d:d}, 
		beforeSend: function(XMLHttpRequest){
		},  
		success: function(json){
			alert(json.info);
		} 
	})
	
}
</script>

</head>
<body>
<?php foreach ($sortlist as $k => $v):?>
<p><span>{$v['frontsortname']}</span></p>
	<?php foreach ($v['cell'] as $m => $n):?>
		<input name="radSortName" type="radio" value="{$n['frontsortid']}" onchange="getvalue(this.value)"><span>{$n['frontsortname']}</span>
	<?php endforeach?>
<?php endforeach?>
<hr />
<div id="div_1" style="display:none" class="divinfo">
</div>
<div id="div_2" style="display:none" class="divinfo">
</div>
<div id="div_3"   class="divinfo">
   <table>
    	<tr>
    		<td>产品名/产品编码：</td><td><input type="text" id="txtproductID3" ></td>
    	</tr>
    	<tr>
    		<td>购买日期：</td><td><input type="text" id="txtbuyDate3" ></td>
    	</tr>
 	    <tr>
    		<td>金额（总价）：</td><td><input type="text" id="txtprice3" ></td>
    	</tr>
	    <tr>
    		<td></td><td><input value="提 交" id="btnadd3" type="button" onclick="return jijingOP();">
    		<input value="获取净值" id="btngetvalue" type="button" onclick="return aa();">
    		</td>
    	</tr>
    </table>
</div>
<div id="div_4" style="display:none" class="divinfo">
</div>
<div id="div_5" style="display:none" class="divinfo">
   <table>
    	<tr>
    		<td>产品名/产品编码：</td><td><input type="text" id="txtproductID4" ></td>
    	</tr>
    	<tr>
    		<td>购买日期：</td><td><input type="text" id="txtbuyDate4" ></td>
    	</tr>
  	    <tr>
    		<td>购买单价：</td><td><input type="text" id="txtprice4" ></td>
    	</tr>
  	  	<tr>
    		<td>购买份数：</td><td><input type="text" id="txtnum4" ></td>
    	</tr>
    	<tr>
    		<td></td><td><input value="提 交" id="btnadd4" type="button"></td>
    	</tr>
    </table>
</div>
<div id="div_6" style="display:none" class="divinfo">
</div>
<div id="div_7" style="display:none" class="divinfo">
</div>

</body>
</html>